home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 9 / FM Towns Free Software Collection 9.iso / t_os / shell / igo / gosource / mdban.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-16  |  4.1 KB  |  177 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <winb.h>
  5. #include <te.h>
  6. #include <fntb.h>
  7. #include <gui.h>
  8.  
  9. #define INITWAITTIME 20
  10.  
  11. extern int    deskTopId;
  12. extern int    textcommentId[10];
  13.  
  14. int    ban_windowId = -1 ;
  15. int    ban_buttonId = -1 ;
  16.  
  17. /*    initDataMIBAN:ban_windowId:MJ_WINDOWL40の呼び出し関数    */
  18. int    igo_disp(kobj, messId, argc, pev, trigger)
  19. int        kobj ;
  20. int        messId ;
  21. int        argc ;
  22. EVENT    *pev ;
  23. int        trigger ;
  24. {
  25.     HYPER hyp;
  26.     FRAME org, size;
  27.     int ichi;
  28.     static short int dx, dy;
  29.     static short int shift;
  30.     int b_terr_number, w_terr_number;
  31.  
  32.     if(messId == MM_SHOW){
  33.         disp_init();
  34.         kifu_disp();
  35.     }else if(messId == MM_UPDATE){
  36.         disp_init();
  37.         kifu_disp();
  38.     }else if(messId == MM_ERASE){
  39.         ;
  40.     }else if(messId == MM_MOUSEON){
  41.         if(pev->what == EVMOSDN){
  42.             dx = *((short *)&(pev->info));
  43.             dy = *(((short *)&(pev->info)) + 1);
  44.             shift = pev->shift;
  45.         }
  46.  
  47.         MMI_SendMessage(kobj, MM_GETUSER, 2, &org, &size);
  48.         MMI_SendMessage(kobj, MM_GETHYPER, 1, &hyp);
  49.  
  50.         dx = dx - (hyp.fr.lupx + org.lupx);
  51.         dy = dy - (hyp.fr.lupy + org.lupy);
  52.  
  53.         ichi = disp_chk( dx, dy);
  54.         switch (ichi){
  55.             case -1: /* 盤外の入力*/
  56.             case -2: /* 盤外の入力*/
  57.                 break;
  58.             default:
  59.                 if(title_judge_read() != 0){
  60.                     if(shift & SLEFTBTN){
  61.                         kifu_judgeput(ichi, &b_terr_number, &w_terr_number);
  62.                         judge_do_set(b_terr_number, w_terr_number);
  63.                         judge_ban_disp();
  64.                     }
  65.                 }else if(mdcheck_input_check(ichi) == 0){
  66.                     if(shift & SLEFTBTN){
  67.                         if(kifu_put(ichi)==0){
  68.                             title_fsave_on();
  69.                         }
  70.                     }else{
  71.                         kifu_cancel();
  72.                     }
  73.                     comment_dispFunc();
  74.                     ban_note_disp();
  75.                 }
  76.                 break;
  77.         }
  78.  
  79.     }
  80.  
  81.     return NOERR ;
  82. }
  83.  
  84. /*    initDataMINOTE:note_windowId:MJ_WINDOWL40の呼び出し関数    */
  85. int    igo_oper(kobj, messId, argc, pev, trigger)
  86. int        kobj ;
  87. int        messId ;
  88. int        argc ;
  89. EVENT    *pev ;
  90. int        trigger ;
  91. {
  92. static int waittime = INITWAITTIME;
  93. static short int shift;
  94. int    ret;
  95.  
  96.     if(messId != MM_MOUSEON){
  97.           return NOERR;
  98.     }
  99.  
  100.     do{
  101.         if(pev->what == EVMOSDN){
  102.             shift = pev->shift;
  103.         }
  104.  
  105.         if(shift & SLEFTBTN){
  106.             kifu_forward();
  107.         }else{
  108.             kifu_back();
  109.         }
  110.  
  111.         comment_dispFunc();
  112.         ban_note_disp();
  113.  
  114.         MMI_WaitLoop(waittime);
  115.         waittime *= 0.75;
  116.     
  117.         MMI_iosense();
  118.     
  119.         ret = MMI_GetEvnt(EVMOSUP, &pev);
  120.     
  121.       }while(ret != NOERR);
  122.     
  123.     waittime = INITWAITTIME;
  124.     return NOERR ;
  125. }
  126.  
  127. int ban_note_disp()
  128. {
  129. WINCTRL *pctrl;
  130. WINCLIP  *pwclp ; 
  131. WINCLIP  *pstackVisible ; 
  132. WINCLIP  *pstackClip ;
  133. HYPER    hyp ;
  134. FRAME    oFr, sFr, cFr ;
  135. POINT    origin, dspOrigin ;
  136.     
  137.     /* 原点移動                                       */
  138.     origin.y = origin.x = 0 ; 
  139.     MG_PushOrigin(&origin, &dspOrigin) ; 
  140.     /* MMI_Openで指定したサイズで設定                */
  141.     MMI_GetControl(&pctrl) ;
  142.     pwclp = WIN_getClipMemory(&pctrl->bound, NULL) ;
  143.     /* WIN_copyClipは省略できない                   */
  144.     WIN_pushVisible(WIN_copyClip(pwclp), &pstackVisible) ;
  145.     WIN_pushClip(pwclp, &pstackClip) ;
  146.     
  147.     /*  ここでMM_SHOWなど描画処理を行う                */ 
  148.     MMI_SendMessage(textcommentId[7], MM_SHOW, 0);
  149.     MMI_SendMessage(textcommentId[9], MM_SHOW, 0);
  150.     
  151.     WIN_popClip(pstackClip) ; 
  152.     WIN_popVisible(pstackVisible) ; 
  153.     MG_PopOrigin(&dspOrigin) ; 
  154.  
  155.  
  156.     /*  原点を ban_windowId  のユーザ領域の左上に移動 */ 
  157.     MMI_SendMessage(ban_windowId, MM_GETHYPER, 1, &hyp) ;
  158.     MMI_SendMessage(ban_windowId, MM_GETUSER, 2, &oFr, &sFr) ; 
  159.     cFr.lupx = dspOrigin.x = hyp.fr.lupx + oFr.lupx ; 
  160.     cFr.lupy = dspOrigin.y = hyp.fr.lupy + oFr.lupy ; 
  161.     cFr.rdwx = cFr.lupx + oFr.rdwx -1 ; 
  162.     cFr.rdwy = cFr.lupy + oFr.rdwy -1 ; 
  163.     MG_PushOrigin(&dspOrigin, &origin) ;
  164.     pwclp = WIN_getClipMemory(&cFr, NULL) ; 
  165.     /* WIN_copyClipでクリップのコピーをビジブルの設定に利用する    */
  166.  
  167.     WIN_pushVisible(WIN_copyClip(pwclp), &pstackVisible) ;
  168.     WIN_pushClip(pwclp, &pstackClip) ;
  169.     /*  ここでWGB 関数などを使用して描画                  */ 
  170.     kifu_disp();
  171.     WIN_popClip(pstackClip) ; 
  172.     WIN_popVisible(pstackVisible) ; 
  173.     /*  原点を元に戻す                         */
  174.     MG_PopOrigin(&origin) ;
  175.     
  176.     return NOERR;
  177. }